//package com.irdstudio.efp.limit.service.impl;
//
//import java.math.BigDecimal;
//import java.util.ArrayList;
//import java.util.HashMap;
//import java.util.List;
//import java.util.Map;
//import java.util.Objects;
//
//import org.slf4j.Logger;
//import org.slf4j.LoggerFactory;
//import org.springframework.beans.factory.annotation.Autowired;
//import org.springframework.beans.factory.annotation.Qualifier;
//import org.springframework.stereotype.Service;
//
//import com.alibaba.fastjson.JSON;
//import com.alibaba.fastjson.JSONObject;
//import com.gdrcu.lp.console.common.BizParamCfgEnum;
//import com.gdrcu.lp.console.service.api.BizParamCfgService;
//import com.gdrcu.lp.console.service.api.PrdInfoService;
//import com.gdrcu.lp.console.service.api.PrdRateStdService;
//import com.gdrcu.lp.console.service.api.RateSchemeDetailService;
//import com.gdrcu.lp.console.service.vo.PrdInfoVO;
//import com.gdrcu.lp.console.service.vo.PrdRateStdVO;
//import com.gdrcu.lp.console.service.vo.RateSchemeDetailVO;
//import com.gdrcu.lp.limit.service.common.LmtIndivAppUtil;
//import com.gdrcu.lp.limit.service.common.PreListAppUtil;
//import com.gdrcu.lp.xf.common.XfConstant;
//import com.gdrcu.lp.xf.service.api.BizFlowExeProcessService;
//import com.gdrcu.lp.xf.service.api.IqpCusIndivService;
//import com.gdrcu.lp.xf.service.api.TelQuestClsAndDtlService;
//import com.gdrcu.lp.xf.service.vo.BizFlowExeProcessVO;
//import com.gdrcu.lp.xf.service.vo.IqpCusIndivVO;
//import com.irdstudio.basic.framework.core.base.AbstractFrameworkService;
//import com.irdstudio.basic.framework.core.base.DataOptionalAuthorityDao;
//import com.irdstudio.basic.framework.core.base.FrameworkService;
//import com.irdstudio.basic.framework.core.constant.BaseConstant;
//import com.irdstudio.basic.framework.core.constant.ChannelConstant;
//import com.irdstudio.basic.framework.core.constant.FlowExceptionType;
//import com.irdstudio.basic.framework.core.constant.MessageScene;
//import com.irdstudio.basic.framework.core.exception.PauseException;
//import com.irdstudio.basic.framework.core.exception.TerminateException;
//import com.irdstudio.basic.framework.core.util.BigDecimalUtil;
//import com.irdstudio.basic.framework.core.util.DateTool;
//import com.irdstudio.basic.framework.core.util.MD5Util;
//import com.irdstudio.basic.framework.core.util.StringUtil;
//import com.irdstudio.basic.framework.core.util.TimeUtil;
//import com.irdstudio.basic.framework.core.vo.FlowOutSimpleVO;
//import com.irdstudio.efp.framework.service.facade.SMSService;
//import com.irdstudio.efp.limit.common.LimitConstant;
//import com.irdstudio.efp.limit.service.dao.LmtIndivAppDao;
//import com.irdstudio.efp.limit.service.dao.LmtPrelistDao;
//import com.irdstudio.efp.limit.service.dao.LmtShowInfoDao;
//import com.irdstudio.efp.limit.service.domain.LmtIndivApp;
//import com.irdstudio.efp.limit.service.domain.LmtPrelist;
//import com.irdstudio.efp.limit.service.domain.LmtShowInfo;
//import com.irdstudio.efp.limit.service.facade.LmtIndivAppService;
//import com.irdstudio.efp.limit.service.vo.LmtIndivAppVO;
//import com.irdstudio.efp.limit.service.vo.PreCreStatus;
///**
// * <p>ServiceImpl: 个人授信申请表				<p>
// * @author chenqm1
// * @date 2018-05-05
// */
//@Service("lmtIndivAppService")
//public class LmtIndivAppServiceImpl extends  AbstractFrameworkService  implements LmtIndivAppService, FrameworkService {
//	
//	private static Logger logger = LoggerFactory.getLogger(LmtIndivAppServiceImpl.class);
//
//	@Autowired
//	private LmtIndivAppDao lmtIndivAppDao;
//	
//	@Autowired
//	private LmtPrelistDao lmtPrelistDao;
//	
//	@Autowired
//	private LmtShowInfoDao lmtShowInfoDao;
//	
//	@Autowired
//	@Qualifier("prdInfoService")
//	private PrdInfoService prdInfoService;
//	
//	@Autowired
//	@Qualifier("prdRateStdService")
//	private PrdRateStdService prdRateStdService;
//	
//	@Autowired
//    @Qualifier("telQuestClsAndDtlService")
//    private TelQuestClsAndDtlService telQuestClsAndDtlService;
//	
//	@Autowired
//	@Qualifier("sMSService")
//	private SMSService sMSService;
//	
//	@Autowired
//	@Qualifier("iqpCusIndivService")
//	private IqpCusIndivService iqpCusIndivService;
//	
//	@Autowired
//	@Qualifier("rateSchemeDetailService")
//	private RateSchemeDetailService rateSchemeDetailService;
//	
//	@Autowired
//	@Qualifier("bizFlowExeProcessService")
//	private BizFlowExeProcessService bizFlowExeProcessService;
//	
//	@Autowired
//	@Qualifier("bizParamCfgService")
//	private BizParamCfgService bizParamCfgService;
//	
//	/**
//	 * 额度申请 额度激活
//	 * 新增授信申请表操作
//	 * @throws Exception 
//	 */
//	public FlowOutSimpleVO insertLmtIndivApp(LmtIndivAppVO lmtIndivAppVo) throws Exception {
//		logger.info("当前新增数据为:"+ JSON.toJSONString(lmtIndivAppVo));
//		FlowOutSimpleVO flowOutSimpleVO = new FlowOutSimpleVO();
//		int num = 0;
//		boolean success = true;
//		try {
//			String openDate = this.getOpenday();
//			LmtIndivApp lmtIndivApp = new LmtIndivApp();
//			lmtIndivApp = (LmtIndivApp)beanCopy(lmtIndivAppVo, lmtIndivApp);
//			//新增前校验
//			LmtPrelist lmtPrelist = new LmtPrelist();
//			lmtPrelist.setPreSerno(lmtIndivAppVo.getPreSerno());
//			//获取正式表中数据
//			logger.info("当前查询正式表参数为: "+JSON.toJSONString(lmtPrelist));
//			lmtPrelist = lmtPrelistDao.queryByPk(lmtPrelist);
//			logger.info("当前查询正式表结果为: "+JSON.toJSONString(lmtPrelist));
//			if (lmtPrelist == null) {
//				throw new Exception("无对应白名单数据");
//			}
//			LmtIndivApp lmtIndivAppResult = lmtIndivAppDao.queryByPk(lmtIndivApp);
//			logger.info("查询授信申请表结果为: "+JSON.toJSONString(lmtIndivAppResult));
//			if (Objects.isNull(lmtIndivAppResult)) {//授信申请表中无数据
//				PrdInfoVO prdInfoVo = new PrdInfoVO();
//                prdInfoVo.setPrdCode(lmtPrelist.getPrdCode());
//                logger.info("查询产品参数Code: "+prdInfoVo.getPrdCode());
//                prdInfoVo = prdInfoService.queryPrdInfo4LmtApply(prdInfoVo.getPrdCode(), lmtPrelist.getTerm().toString());
//                //利率方案
//                RateSchemeDetailVO rateSchemeDetailVO = new RateSchemeDetailVO();
//                logger.info("查询产品结果为: "+JSON.toJSONString(prdInfoVo));
//                if (Objects.nonNull(prdInfoVo)) {
//                    rateSchemeDetailVO = prdInfoVo.getRateSchemeDetail();
//                    logger.info("产品利率方案配置为: "+JSON.toJSONString(rateSchemeDetailVO));
//                }else {
//                    logger.error("查询最新产品失败");
//                    throw new Exception("查询最新产品为空！");
//                }
//                
//                lmtPrelist.setPrdId(prdInfoVo.getPrdId()); //设置最新产品ID
//                //设置预授信名单信息
//                LmtIndivAppUtil.setInfoByPrd(lmtPrelist, prdInfoVo, rateSchemeDetailVO);
//                
//                if (BaseConstant.IR_MODE_FIXED.equals(lmtPrelist.getIrMode())) {
//                    if (Objects.isNull(lmtPrelist.getFixedRate())) {
//                        lmtPrelist.setFixedRate(rateSchemeDetailVO.getFixedRate());//设固定利率
//                        lmtPrelist.setIrAdjustMode(BaseConstant.IREXE_TYPE_6);//设固定利率的调整方式
//                    }else {
//                        lmtPrelist.setIrAdjustMode(BaseConstant.IREXE_TYPE_6);//设固定利率的调整方式
//                    }
//                }else {
//                    if (StringUtil.isEmpty(lmtPrelist.getIrAdjustMode())||BaseConstant.IREXE_TYPE_6.equals(lmtPrelist.getIrAdjustMode())) {
//                        String irAdjustMode = Objects.isNull(rateSchemeDetailVO)?prdInfoVo.getRateAdjustType():rateSchemeDetailVO.getRateAdjustType();
//                        
//                        lmtPrelist.setIrAdjustMode(irAdjustMode);//利率调整方式(利率执行方式)
//                    }
//                    if (StringUtil.isEmpty(lmtPrelist.getIrFloatType())) {//利率浮动方式  
//                        if (rateSchemeDetailVO.getFloatRate().signum()==-1) {
//                            lmtPrelist.setIrFloatType(BaseConstant.IR_FLOAT_TYPE_DOWN);
//                        }else {
//                            lmtPrelist.setIrFloatType(BaseConstant.IR_FLOAT_TYPE_UP);
//                        }
//                    }
//                    if (Objects.isNull(lmtPrelist.getIrFloatPct())) {
//                        if (Objects.nonNull(rateSchemeDetailVO.getFloatRate())) {
//                            lmtPrelist.setIrFloatPct(rateSchemeDetailVO.getFloatRate().abs());//浮动比例
//                        }else {
//                            logger.error("获取利率方案浮动比例为空");
//                            lmtPrelist.setIrFloatPct(BigDecimal.ZERO);
//                        }
//                    }
//                }
//                
//                //设置个人授信申请表数据
//                lmtIndivApp = LmtIndivAppUtil.setLmtIndivAppByLmtPrelist(lmtIndivApp, lmtPrelist);
//                
//                //获取业务参数：批复有效期
//                String apprExpireDays = bizParamCfgService.bizParamCfgEnumFn(lmtPrelist.getLegalOrgCode(), BizParamCfgEnum.APPR_EXPIRY_DT);
//                if(StringUtil.isStrNotEmpty(apprExpireDays)) {
//                    lmtIndivApp.setValidDays(new BigDecimal(apprExpireDays));//授信批复有效期
//                }
//                
//                lmtIndivApp.setLmtSerno(lmtIndivAppVo.getLmtSerno());
//                lmtIndivApp.setApplyDate(openDate);
//                lmtIndivApp.setEndorseDate(openDate);
//				
//				//插入产查询产品获取的信息
//				lmtIndivApp = LmtIndivAppUtil.setLmtIndivAppByPrdInfo(lmtIndivApp, lmtPrelist, prdInfoVo);
//				//利率模式：浮动利率
//			    if(BaseConstant.IR_MODE_FLOATING.equals(lmtPrelist.getIrMode())) {
//			      //利率方案 Vo
//	                PrdRateStdVO prdRateStdVO = PreListAppUtil.getPrdInfoId(lmtPrelist);
//	                //获取利率方案
//	                prdRateStdVO = prdRateStdService.queryByRange(prdRateStdVO);
//	                //插入利率
//	                lmtIndivApp = LmtIndivAppUtil.setRateY(lmtIndivApp, prdRateStdVO, lmtPrelist);
//			    } else {
//			        BigDecimal rateY = BigDecimalUtil.cutOutDecimal(lmtPrelist.getFixedRate(), 6);
//			        lmtIndivApp.setApplyRateY(rateY);
//			        lmtIndivApp.setApproveRateY(rateY);
//			    }
//				//额度测算
//			    lmtIndivApp.setIsCreInfo(BaseConstant.YES);//是否同意查征信
//				lmtIndivApp.setApproveStatus(BaseConstant.APPR_STATUS_111);
//				lmtIndivApp.setCreateUser(lmtPrelist.getCusManager());//创建人
//				lmtIndivApp.setCreateTime(TimeUtil.getCurrentDateTime());//创建 时间
//				lmtIndivApp.setLastUpdateUser(lmtPrelist.getCusManager());//最后更新人
//				lmtIndivApp.setLastUpdateTime(TimeUtil.getCurrentDateTime());//最后更新时间
//				
//				//渠道代码，这里暂时默认手机银行  add by 20180731
//				lmtIndivApp.setChannelCode(ChannelConstant.MOBILE_BANK_APP);
//				
//				//数据插表
//				num = lmtIndivAppDao.insertLmtIndivApp(lmtIndivApp);
//	
//				//回写正式表操作字段 及流水号
//				lmtPrelist.setCurOp(LimitConstant.PRELMT_OP_10);//额度申请中
//				lmtPrelist.setLmtSerno(lmtIndivApp.getLmtSerno());
//				lmtPrelist.setLastUpdateTime(TimeUtil.getCurrentDateTime());//最后更新时间
//				
//				lmtPrelistDao.updateLmtPrelistStatus(lmtPrelist);//回写
//				
//				//更新lmt_show_info表
//				LmtShowInfo lmtShowInfo = new LmtShowInfo();
//				lmtShowInfo.setPreSerno(lmtIndivApp.getPreSerno());//预授信流水号
//				lmtShowInfo.setLmtSerno(lmtIndivApp.getLmtSerno());//授信申请流水号
//				lmtShowInfo.setRateY(lmtIndivApp.getApproveRateY());//执行利率
//				lmtShowInfo.setPrdType(lmtIndivApp.getPrdType());//产品类型
//				lmtShowInfo.setLmtStatus(PreCreStatus.APPLY_DO.getCode());//申请中
//				lmtShowInfo.setLastUpdateTime(TimeUtil.getCurrentDateTime());//最后更新时间
//				lmtShowInfoDao.updateLmtShowInfoByPreSerno(lmtShowInfo);
//			}else {
//				lmtIndivApp = lmtIndivAppResult;
//			}
//			flowOutSimpleVO.setBizSerno(lmtIndivApp.getLmtSerno());//授信申请流水号
//			flowOutSimpleVO.setCusId(lmtIndivApp.getCusId());//客户编号
//			flowOutSimpleVO.setCusName(lmtIndivApp.getCusName());//客户名称
//			flowOutSimpleVO.setCertType(lmtIndivApp.getCertType());//证件类型
//			flowOutSimpleVO.setCertCode(lmtIndivApp.getCertCode());//证件号码
//			flowOutSimpleVO.setMobile(lmtPrelist.getMobile());//手机号
//			flowOutSimpleVO.setPrdId(lmtIndivApp.getPrdId());//产品ID
//			flowOutSimpleVO.setLegalOrgCode(lmtIndivApp.getLegalOrgCode());//法人机构号
//		}catch (Exception e) {
//		    success = false;
//			logger.error("新增数据发生异常!", e);
//			num = -1;
//			throw new PauseException(e.getMessage());
//		} finally {
//		    if(success) {
//		        //插入业务流转执行过程记录
//		        this.addBizFlowExeProcess(lmtIndivAppVo.getLmtSerno(), flowOutSimpleVO);
//		    }
//		}
//		logger.info("当前新增数据条数为:"+ num);
//		return flowOutSimpleVO;
//	}
//	
//	/**
//	 * 插入业务流转执行过程记录
//	 * @param bizSerno
//	 * @param result
//	 */
//	private void addBizFlowExeProcess(String bizSerno, Object result) {
//	    //获取调用此方法的方法名
//        String clazzName = this.getClass().getName();
//        //elmArr[1].getMethodName()：当前方法名，elmArr[2].getMethodName()：调用当前方法的方法名，以此类推
//        StackTraceElement[] elmArr = Thread.currentThread().getStackTrace();
//        String methodName = elmArr[2].getMethodName();
//        String wholeNameMD5 = MD5Util.getMD5ofStr(clazzName + "." + methodName);
//        
//        BizFlowExeProcessVO bizFlowExeProcessVo = new BizFlowExeProcessVO();
//        bizFlowExeProcessVo.setBizSerno(bizSerno);//业务流水号
//        bizFlowExeProcessVo.setExeMethodMd5(wholeNameMD5);//执行方法名MD5值
//        bizFlowExeProcessVo.setFinishSteps(1);//已完成步骤数
//        bizFlowExeProcessVo.setTotalSteps(1);//总步骤数
//        bizFlowExeProcessVo.setFinishInd(BaseConstant.YES);//是否已完成
//        bizFlowExeProcessVo.setResultParam(JSONObject.toJSONString(result));//执行结果参数
//        bizFlowExeProcessVo.setCreateTime(TimeUtil.getCurrentDateTime());//创建时间
//        bizFlowExeProcessVo.setLastUpdateTime(TimeUtil.getCurrentDateTime());//最后修改时间
//        bizFlowExeProcessService.insertBizFlowExeProcess(bizFlowExeProcessVo);
//	}
//
//	/**
//	 * 删除操作
//	 */
//	public int deleteByPk(LmtIndivAppVO inLmtIndivAppVo) {
//		logger.debug("当前删除数据条件为:"+ JSON.toJSONString(inLmtIndivAppVo));
//		int num = 0;
//		try {
//			LmtIndivApp lmtIndivApp = new LmtIndivApp();
//			lmtIndivApp = (LmtIndivApp)beanCopy(inLmtIndivAppVo, lmtIndivApp);
//			num = lmtIndivAppDao.deleteByPk(lmtIndivApp);
//		} catch (Exception e) {
//			logger.error("删除数据发生异常!", e);
//			num = -1;
//		}
//		logger.debug("根据条件:"+ inLmtIndivAppVo +"删除的数据条数为"+ num);
//		return num;
//	}
//
//
//	/**
//	 * 更新操作
//	 */
//	public int updateByPk(LmtIndivAppVO inLmtIndivAppVo) {
//		logger.debug("当前修改数据为:"+ JSON.toJSONString(inLmtIndivAppVo));
//		int num = 0;
//		try {
//			LmtIndivApp lmtIndivApp = new LmtIndivApp();
//			lmtIndivApp = (LmtIndivApp)beanCopy(inLmtIndivAppVo, lmtIndivApp);
//			lmtIndivApp.setLastUpdateTime(DateTool.getCurrentDateTime());
//			num = lmtIndivAppDao.updateByPk(lmtIndivApp);
//		} catch (Exception e) {
//			logger.error("修改数据发生异常!", e);
//			num = -1;
//		}
//		logger.debug("根据条件:"+ inLmtIndivAppVo +"修改的数据条数为"+ num);
//		return num;
//	}
//	
//	/**
//	 * 查询操作
//	 */
//	public LmtIndivAppVO queryByPk(LmtIndivAppVO inLmtIndivAppVo) {
//		
//		logger.debug("当前查询参数信息为:"+ JSON.toJSONString(inLmtIndivAppVo));
//		try {
//			LmtIndivApp queryLmtIndivApp = new LmtIndivApp();
//			queryLmtIndivApp = (LmtIndivApp)beanCopy(inLmtIndivAppVo, queryLmtIndivApp);
//			LmtIndivApp queryRslLmtIndivApp = lmtIndivAppDao.queryByPk(queryLmtIndivApp);
//			if (Objects.nonNull(queryRslLmtIndivApp)) {
//				LmtIndivAppVO outLmtIndivAppVo = beanCopy(queryRslLmtIndivApp, new LmtIndivAppVO());
//				logger.debug("当前查询结果为:"+ outLmtIndivAppVo.toString());
//				return outLmtIndivAppVo;
//			} else {
//				logger.debug("当前查询结果为空!");
//			}
//		} catch (Exception e) {
//			logger.error("查询数据发生异常!", e);
//		}
//		return null;
//	}
//
//
//	/**
//	 * 查询用户权限数据
//	 */
//	@SuppressWarnings("unchecked")
//	public List<LmtIndivAppVO> queryAllOwner(LmtIndivAppVO lmtIndivAppVo) {
//		logger.debug("当前查询本人所属数据信息的参数信息为:"+JSON.toJSONString(lmtIndivAppVo));
//		LmtIndivApp lmtIndivApp = new LmtIndivApp();
//		lmtIndivApp = (LmtIndivApp)beanCopy(lmtIndivAppVo, lmtIndivApp);
//		List<LmtIndivAppVO> list = new ArrayList<>();
//		try {
//			List<LmtIndivApp> lmtIndivApps = lmtIndivAppDao.queryAllOwnerByPage(lmtIndivAppVo);
//			logger.debug("当前查询本人所属数据信息的结果集数量为:"+ lmtIndivApps.size());
//			pageSet(lmtIndivApps, lmtIndivAppVo);
//			list = (List<LmtIndivAppVO>) beansCopy(lmtIndivApps, LmtIndivAppVO.class);
//		} catch (Exception e) {
//			logger.error("数据转换出现异常!", e);
//			return null;
//		}
//		
//		return list;
//	
//	}
//
//
//	/**
//	 * 查询当前机构权限数据
//	 */
//	@SuppressWarnings("unchecked")
//	public List<LmtIndivAppVO> queryAllCurrOrg(LmtIndivAppVO lmtIndivAppVo) {
//
//		logger.debug("当前查询本人所属机构数据信息的参数信息为:");
//		List<LmtIndivApp> lmtIndivApps = lmtIndivAppDao.queryAllCurrOrgByPage(lmtIndivAppVo);
//		logger.debug("当前查询本人所属机构数据信息的结果集数量为:"+lmtIndivApps.size());
//		LmtIndivApp lmtIndivApp = new LmtIndivApp();
//		lmtIndivApp = (LmtIndivApp)beanCopy(lmtIndivAppVo, lmtIndivApp);
//		List<LmtIndivAppVO> list = new ArrayList<>();
//		try {  
//			pageSet(lmtIndivApps, lmtIndivApp);
//			list = (List<LmtIndivAppVO>) beansCopy(lmtIndivApps, LmtIndivAppVO.class);
//		} catch (Exception e) {
//			logger.error("数据转换出现异常!", e);
//		}
//		return list;
//	
//	}
//
//
//	/**
//	 * 查询当前机构及下属机构权限数据
//	 */
//	@SuppressWarnings("unchecked")
//	public List<LmtIndivAppVO> queryAllCurrDownOrg(LmtIndivAppVO lmtIndivAppVo) {
//
//		logger.debug("当前查询本人所属机构及以下数据信息的参数信息为:");
//		List<LmtIndivApp> lmtIndivApps = lmtIndivAppDao.queryAllCurrDownOrgByPage(lmtIndivAppVo);
//		logger.debug("当前查询本人所属机构及以下数据信息的结果集数量为:"+ lmtIndivApps.size());
//		List<LmtIndivAppVO> list = null;
//		LmtIndivApp lmtIndivApp = new LmtIndivApp();
//		lmtIndivApp = (LmtIndivApp)beanCopy(lmtIndivAppVo, lmtIndivApp);
//		try {
//			pageSet(lmtIndivApps, lmtIndivApp);
//			list = (List<LmtIndivAppVO>) beansCopy(lmtIndivApps, LmtIndivAppVO.class);
//		} catch (Exception e) {
//			logger.error("数据转换出现异常!", e);
//		}	
//		return list;
//	}
//	/**
//	 * 更新个人授信申请表状态服务
//	 */
//	@Override
//	public int updateLmtIndivAppStatus(LmtIndivAppVO lmtIndivAppVO) {
//		int num = 0;
//		logger.debug("当前输入参数为: "+JSON.toJSONString(lmtIndivAppVO));
//		try {			
//			LmtIndivApp lmtIndivApp = new LmtIndivApp();
//			lmtIndivApp = (LmtIndivApp)beanCopy(lmtIndivAppVO, lmtIndivApp);
//			//更新时间
//			lmtIndivApp.setLastUpdateTime(DateTool.getCurrentDateTime());
//			//状态更新
//			num = lmtIndivAppDao.updateLmtIndivAppStatus(lmtIndivApp);			
//			logger.debug("根据条件:"+ JSON.toJSONString(lmtIndivApp) +"修改的数据条数为"+ num);
//		} catch (Exception e) {
//			logger.error("修改状态发生异常!", e);
//			num = -1;
//		}
//		return num;
//	}
//     
//	
//	/**
//	 * 额度申请进度查询
//	 * @param lmtIndivAppVO
//	 * @return
//	 */
//	@Override
//	public List<LmtIndivAppVO> queryIndivProcess(LmtIndivAppVO lmtIndivAppVO) {
//		logger.info("当前查询参数为: "+JSON.toJSONString(lmtIndivAppVO));
//		LmtIndivApp lmtIndivApp = new LmtIndivApp();
//		List<LmtIndivAppVO> responseData = null;
//		try {
//			lmtIndivApp = (LmtIndivApp)beanCopy(lmtIndivAppVO, lmtIndivApp);
//			//String[] approveStatusArr = {"审批中","通过","否决"};
//			String[] approveStatusArr = null;
//			if (StringUtil.isEmpty(lmtIndivAppVO.getApproveStatus())) {
//				approveStatusArr= new String[]{BaseConstant.APPR_STATUS_111,BaseConstant.APPR_STATUS_997,BaseConstant.APPR_STATUS_998};			
//			}else {
//				approveStatusArr= new String[]{lmtIndivAppVO.getApproveStatus()};				
//				};	
//			//String[] actStsArr = {"待激活","已激活"};
//			//String[] actStsArr = {"30","32"};
//			List<LmtIndivApp> resultData = 
//					lmtIndivAppDao.queryIndivProcess(lmtIndivApp, approveStatusArr);
//			logger.info("额度申请进度查询结果集为: "+JSON.toJSONString(resultData));
//			pageSet(resultData, lmtIndivApp);
//			responseData = (List<LmtIndivAppVO>) beansCopy(resultData,LmtIndivAppVO.class);		
//		} catch (Exception e) {
//			logger.error("查询失败",e);
//		}
//		return responseData;
//	}
//
//    @Override
//    public FlowOutSimpleVO insertLmtIndivApp(String preSerno, String bizSerno) throws Exception {
//        //查询预授信信息
//        LmtIndivAppVO lmtIndivAppVO = new LmtIndivAppVO();
//        lmtIndivAppVO.setPreSerno(preSerno);//预授信编号
//        lmtIndivAppVO.setLmtSerno(bizSerno);//授信申请流水号
//        return insertLmtIndivApp(lmtIndivAppVO);
//    }
//
//    @Override
//    public boolean judgeIsTelVerifyPass(String bizSerno) throws Exception {
//        boolean reject = false;
//        try {
//            String result = telQuestClsAndDtlService.judgeIsTelVerifyPass(bizSerno);
//            logger.info(bizSerno+"电核结果：" + result);
//            if(XfConstant.TEL_VERIFY_RESULT_REJECT.equals(result)) {
//                reject = true;
//                throw new TerminateException(FlowExceptionType.FLOW, "电核结果不通过，业务流转终止！bizSerno="+bizSerno);
//            } else if(XfConstant.TEL_VERIFY_RESULT_WAIT.equals(result)) {
//                throw new PauseException("电核结果未返回，业务流程暂停等待！bizSerno="+bizSerno);
//            }
//        } catch (Exception e) {
//            logger.error(e.getMessage());
//            throw e;
//        } finally {
//            if(reject) {
//                logger.info(bizSerno+"电核结果为拒绝，更新授信申请和预授信名单状态......");
//                //更新授信申请审批状态
//                LmtIndivApp lmtIndivApp = new LmtIndivApp();
//                lmtIndivApp.setLmtSerno(bizSerno);
//                lmtIndivApp.setApproveStatus(BaseConstant.APPR_STATUS_998);
//                lmtIndivApp.setRejectReason(LimitConstant.REJECT_REASON_04);//拒绝原因
//                lmtIndivApp.setLastUpdateTime(TimeUtil.getCurrentDateTime());
//                lmtIndivAppDao.updateByPk(lmtIndivApp);
//                
//                //更新预授信名单状态
//                lmtIndivApp = lmtIndivAppDao.queryByPk(lmtIndivApp);
//                LmtPrelist lmtPrelist = new LmtPrelist();
//                lmtPrelist.setPreSerno(lmtIndivApp.getPreSerno());
//                lmtPrelist.setStatus(LimitConstant.PRELMT_STS_90);//拒绝
//                lmtPrelist.setRemarks("电核被拒绝。");
//                lmtPrelist.setLastUpdateTime(TimeUtil.getCurrentDateTime());
//                lmtPrelistDao.updateByPk(lmtPrelist);
//                
//                //更新lmt_show_info表
//                LmtShowInfo lmtShowInfo = new LmtShowInfo();
//                lmtShowInfo.setLmtSerno(bizSerno);//授信申请流水号
//                lmtShowInfo.setLmtStatus(PreCreStatus.APPLY_FAIL.getCode());//申请失败
//                lmtShowInfo.setIncLmtInd(BaseConstant.NO);//不允许提额
//                lmtShowInfo.setLastUpdateTime(TimeUtil.getCurrentDateTime());//最后更新时间
//                lmtShowInfoDao.updateShowInfoByLmtSerno(lmtShowInfo);
//                
//                //发送短信
//                logger.info(bizSerno+"授信申请电核拒绝，发送短信......");
//                lmtPrelist = lmtPrelistDao.queryByPk(lmtPrelist);
//                List<String> tel = new ArrayList<>();
//                tel.add(lmtPrelist.getMobile());//手机号码
//                Map<String, String> messageParam = new HashMap<>();
//                messageParam.put("NAME", lmtIndivApp.getCusName());//姓名
//                messageParam.put("BRCH_NO", lmtIndivApp.getLegalOrgCode());//机构号
//                sMSService.sendSms(tel, MessageScene.YUENONG_ELOAN_APPLY_REJECT.getTemplateId(), messageParam, true);
//            }
//        }
//        return true;
//    }
//
//    @Override
//    public boolean updateApproveStatus(String bizSerno) throws Exception {
//        try {
//            logger.info(bizSerno+"审批通过，更新授信申请和预授信名单状态......");
//            String cusName = null;
//            IqpCusIndivVO iqpCusIndivVo = new IqpCusIndivVO();
//            iqpCusIndivVo.setBizSerno(bizSerno);
//            iqpCusIndivVo = iqpCusIndivService.queryByPk(iqpCusIndivVo);
//            cusName = iqpCusIndivVo==null?null:iqpCusIndivVo.getCusName();//客户名称，以核心返回为准
//            
//            //更新授信申请审批状态
//            LmtIndivApp lmtIndivApp = new LmtIndivApp();
//            lmtIndivApp.setLmtSerno(bizSerno);
//            if(StringUtil.isNotEmpty(cusName)) {
//                lmtIndivApp.setCusName(cusName);
//            }
//            lmtIndivApp.setApproveStatus(BaseConstant.APPR_STATUS_997);
//            lmtIndivApp.setLastUpdateTime(TimeUtil.getCurrentDateTime());
//            lmtIndivAppDao.updateByPk(lmtIndivApp);
//            
//            //更新预授信名单状态
//            lmtIndivApp = lmtIndivAppDao.queryByPk(lmtIndivApp);
//            LmtPrelist lmtPrelist = new LmtPrelist();
//            lmtPrelist.setPreSerno(lmtIndivApp.getPreSerno());
//            if(StringUtil.isNotEmpty(cusName)) {
//                lmtPrelist.setCusName(cusName);
//            }
//            lmtPrelist.setStatus(LimitConstant.PRELMT_STS_30);//待激活
//            lmtPrelist.setCurOp(LimitConstant.PRELMT_OP_00);//当前操作更新为：无
//            lmtPrelist.setWaitActAmt(lmtIndivApp.getApproveAmt());//待激活额度
//            lmtPrelist.setRemarks("审批通过。");
//            lmtPrelist.setLastUpdateTime(TimeUtil.getCurrentDateTime());
//            lmtPrelistDao.updateByPk(lmtPrelist);
//            
//            //更新lmt_show_info表
//            LmtShowInfo lmtShowInfo = new LmtShowInfo();
//            lmtShowInfo.setLmtSerno(bizSerno);//授信申请流水号
//            lmtShowInfo.setLmtType(LimitConstant.PRELMT_TYPE_1);//申请得到额度，修改预授信额度类型：预授信额度
//            lmtShowInfo.setLmtStatus(PreCreStatus.ACTIVE_WAIT.getCode());//待激活
//            lmtShowInfo.setWaitActAmt(lmtIndivApp.getApproveAmt());//待激活额度
//            lmtShowInfo.setIncLmtInd(BaseConstant.YES);//允许提额
//			lmtShowInfo.setLmtAmt(lmtIndivApp.getApplyAmt()); //修改为 额度审批通过后的计算出来的金额
//            lmtShowInfo.setLastUpdateTime(TimeUtil.getCurrentDateTime());//最后更新时间
//            lmtShowInfoDao.updateShowInfoByLmtSerno(lmtShowInfo);
//            
//            //发送短信
//            logger.info(bizSerno+"授信申请审批通过，发送短信......");
//            lmtPrelist = lmtPrelistDao.queryByPk(lmtPrelist);
//            List<String> tel = new ArrayList<>();
//            tel.add(lmtPrelist.getMobile());//手机号码
//            Map<String, String> messageParam = new HashMap<>();
//            messageParam.put("NAME", lmtIndivApp.getCusName());//姓名
//            messageParam.put("TX_AMT", lmtIndivApp.getApproveAmt().toString());//额度
//            messageParam.put("BRCH_NO", lmtIndivApp.getLegalOrgCode());//机构号
//            sMSService.sendSms(tel, MessageScene.YUENONG_ELOAN_APPLY_APPROVE.getTemplateId(), messageParam, true);
//        } catch (Exception e) {
//            logger.error("审批通过，更新授信申请和预授信名单状态出现异常！", e);
//            throw new PauseException("审批通过，更新授信申请和预授信名单状态出现异常！"+e.getMessage());
//        }
//        return false;
//    }
//
//	@Override
//	public boolean limitApplySuccess(LmtIndivAppVO lmtIndivAppVO) {
//		// TODO Auto-generated method stub
//		return false;
//	}
//
//    @Override
//    public List<LmtIndivAppVO> queryByCondition(LmtIndivAppVO inLmtIndivAppVo) {
//        logger.debug("当前查询参数信息为:"+ JSON.toJSONString(inLmtIndivAppVo));
//        try {
//            List<LmtIndivApp> listLmtIndivApp = lmtIndivAppDao.queryByCondition(inLmtIndivAppVo);
//            if(Objects.isNull(listLmtIndivApp)) {
//                return null;
//            }
//            List<LmtIndivAppVO> list = new ArrayList<>();
//            try {  
//                list = (List<LmtIndivAppVO>) beansCopy(listLmtIndivApp, LmtIndivAppVO.class);
//            } catch (Exception e) {
//                logger.error("数据转换出现异常!", e);
//            }
//            return list;
//        } catch (Exception e) {
//            logger.error("查询数据发生异常!", e);
//        }
//        return null;
//    }
//
//    /**
//     * 获取最后一次被拒记录
//     */
//	@Override
//	public String getLatestRejectDate(LmtIndivAppVO lmtIndivAppVO) {
//		logger.info("查询被拒记录参数为: "+JSON.toJSONString(lmtIndivAppVO));
//		LmtIndivApp lmtIndivApp = new LmtIndivApp();
//		lmtIndivApp = (LmtIndivApp)beanCopy(lmtIndivAppVO, lmtIndivApp);
//		String createDate = null;
//		try {
//			createDate = lmtIndivAppDao.getLatestRejectDate(lmtIndivApp);
//			logger.info("当前查询结果为: "+createDate);
//			return createDate;
//		} catch (Exception e) {
//			logger.error("查询记录出错!",e);
//		}
//		return null;
//	}
//
//	/**
//	 * 获取当日申请笔数
//	 */
//	@Override
//	public int getApplyCount(LmtIndivAppVO lmtIndivAppVO) {
//		int num = 0;
//		try {
//			String openDate = this.getOpenday();
//			LmtIndivApp lmtIndivApp = new LmtIndivApp();
//			lmtIndivApp = (LmtIndivApp)beanCopy(lmtIndivAppVO, lmtIndivApp);
//			lmtIndivApp.setApplyDate(openDate);
//			logger.info("当前查询参数为: "+JSON.toJSONString(lmtIndivApp));
//			if (StringUtil.isEmpty(lmtIndivApp.getCertCode())||StringUtil.isEmpty(lmtIndivApp.getCertType())||StringUtil.isEmpty(lmtIndivApp.getApplyDate())) {
//				throw new Exception("查询参数不全!");
//			}
//			num = lmtIndivAppDao.getApplyCount(lmtIndivApp);			
//		} catch (Exception e) {
//			logger.error("查询出错!",e);
//			num = -1;
//		}	
//		return num;
//	}
//
//	@Override
//	public DataOptionalAuthorityDao getDataAuthorityDao() {
//		return this.lmtIndivAppDao;
//	}
//}
